// ❤ 一级路由页面 
// Home  // 默认文件页面
//    ❤ 二级： HomePage 首页
//     FindHouse 找房 
//     Publish 发布
//     Message 消息
//     My  我的
// Search  //搜索
// Login //登录
// Detail //详情


import Home from "../views/Home" //直接引入Home页
import {
    lazy
} from "react"; //路由懒加载

import {
    WapHomeO,
    FriendsO,
    VolumeO,
    GuideO,
    FlowerO
} from '@react-vant/icons'; //引入需要的图标【下包--》引入使用的图标----》使用图标】



const routes = [{
        path: "/home", //❤ 一级路由路径
        component: Home, //在顶部引入一级路由，使用组件
        children: [ // ❤ 二级路由
            {
                path: "/home/homepage", //二级路由路径，需要在此拼接好一二级路由，方便渲染
                component: lazy(() => import("../views/home/HomePage")), //路由懒加载，减少首页引入内存
                title: "首页",
                icon: < WapHomeO />
            },
            {
                path: "/home/findhouse",
                component: lazy(() => import("../views/home/FindHouse")),
                title: "找房",
                icon: < GuideO />
            },
            {
                path: "/home/message",
                component: lazy(() => import("../views/home/Message")),
                title: "消息",
                icon: < VolumeO />
            },
            {
                path: "/home/publish",
                component: lazy(() => import("../views/home/Publish")),
                title: "发布",
                icon: < FlowerO />
            },
            {
                path: "/home/my",
                component: lazy(() => import("../views/home/My")),
                title: "我的",
                icon: < FriendsO />
            },

        ],
    },
    {
        path: "/search",
        component: lazy(() => import("../views/Search")),
        title: "搜索"
    },
    {
        path: "/login",
        component: lazy(() => import("../views/Login")),
        title: "登录"
    },
    {
        path: "/detail",
        component: lazy(() => import("../views/Detail")),
        title: "详情"
    },
    // 路由重定向 --- 放在最后【默认路由路径】
    {
        path: "/",
        redirect: '/home/homepage', // 重定向:重新指向其它path,会改变网址
    }
]

// 抛出 
export default routes